The Prime Number Theorem
Introduction
Prime numbers feel mysterious at first glance. They appear irregular and unpredictable, yet mathematicians have discovered deep patterns in how often they occur.
This article explores those patterns, culminating in one of the great achievements of mathematics: the Prime Number Theorem (PNT).
Key goals of this article:
- Understand how mathematicians “count” primes
- See what the Prime Number Theorem actually says
- Explore why it matters
Why the Distribution of Primes Matters
Prime numbers matter because:
- They are the foundation of number theory
- They appear in cryptography (e.g., RSA encryption)
- They reveal surprising patterns in the integers
- They connect to deep ideas in analysis and geometry
Understanding how often primes appear is a central question in mathematics.
Counting Primes: The Prime‑Counting Function $\pi(x)$
To study prime distribution, mathematicians use a function:
- $\pi(x)$ = the number of primes less than or equal to $x$
Examples:
- $\pi(10) = 4$ (primes: 2, 3, 5, 7)
- $\pi(100) = 25$
- $\pi(1000) = 168$
Why this function matters:
- It gives a precise way to measure prime density
- It allows us to compare actual counts with predictions
Historical Attempts to Understand Prime Patterns
Early mathematicians noticed:
- Primes become less frequent as numbers grow
- But they never stop appearing
- Their spacing seems irregular
Key historical figures:
- Euclid: proved infinitely many primes
- Euler: connected primes to infinite series
- Gauss & Legendre: made early guesses about prime density
These early insights paved the way for the Prime Number Theorem.
Gauss and Legendre: Early Conjectures About Prime Density
Both Gauss and Legendre independently studied tables of primes and proposed formulas for $\pi(x)$.
Gauss’s idea
He suggested that primes around a large number $x$ occur with density roughly: $$\frac{1}{\ln x}$$ This leads to the approximation: $$\pi(x) \approx \frac{x}{\ln x}$$
Legendre’s idea
He proposed a slightly different formula: $$\pi(x) \approx \frac{x}{\ln x - 1.08366}$$ Gauss’s version turned out to be the correct leading behavior.
The Prime Number Theorem: Statement and Meaning
The Prime Number Theorem (PNT) states: $$\pi(x) \sim \frac{x}{\ln x}$$
- The symbol $\sim$ means that the ratio of the two expressions approaches 1 as $x$ becomes large.
In plain language:
- The number of primes up to $x$ is approximately $x / \ln x$
- The approximation gets better for larger $x$
This is a profound insight into the structure of the integers.
Understanding $\pi(x) \sim x / \ln x$
Why does this approximation make sense?
Key ideas:
- Larger numbers have more potential divisors
- So primes become rarer
- The function $\ln x$ grows slowly
- Dividing by $\ln x$ captures the decreasing density
Interpretation:
- Around $x = 1{,}000{,}000$, the density of primes is about $$\frac{1}{\ln(1{,}000{,}000)} \approx \frac{1}{13.8}$$ meaning roughly 1 prime out of every 14 numbers.
How Good Is the Approximation?
Some sample comparisons:
| $x$ | Actual $\pi(x)$ | Approx. $x/\ln x$ |
|---|
| 100 | 25 | 21.7 |
| 1,000 | 168 | 144.8 |
| 1,000,000 | 78,498 | 72,382 |
Observations:
- The approximation is always a bit low
- But the relative error shrinks as $x$ grows
- The trend is remarkably accurate
What the Theorem Doesn’t Tell Us
The PNT does not answer:
- Where the next prime is
- How large the gaps between primes can be
- Whether there are infinitely many twin primes
- Whether primes follow any simple pattern
It describes average behavior, not exact positions.
A Glimpse at the Ideas Behind the Proof
The proof of the PNT (completed in 1896) uses advanced tools, but the broad strokes involve:
- Studying the Riemann zeta function
- Connecting primes to zeros of this function
- Using complex analysis to estimate prime density
You don’t need the details to appreciate the result—just the idea that primes are linked to deep analytic structures.
Connections to the Riemann Hypothesis
The Riemann Hypothesis (RH) is one of the most famous unsolved problems in mathematics.
Connections to primes:
- RH predicts an even more accurate formula for $\pi(x)$
- It would give extremely precise bounds on prime gaps
- It would refine our understanding of prime randomness
The PNT is like the “first layer” of this deeper mystery.
Calculator
Defining $\pi(x)$
- We can define a custom function for calculating $\pi(x)$
pnt(x) = x / log(x) pnt(100) pnt(1000) pnt(1000000)
Exercises
Try these to reinforce your understanding.
- Compute $\pi(20)$ by listing all primes up to 20.
- Compare $\pi(100)$ with the approximation $100 / \ln 100$.
- Estimate how many primes are below $x = 10{,}000$ using $x / \ln x$.
- Explain in your own words why primes become less frequent as numbers grow.
- Use the density $1/\ln x$ to estimate how many primes lie between 1,000,000 and 1,010,000.
- True or false: The PNT tells us exactly where the next prime is.
- Explain what the symbol $\sim$ means in the statement $\pi(x) \sim x/\ln x$.
- Bonus: Find an $x$ where the approximation $x/\ln x$ is within 5% of the true value of $\pi(x)$.